package cn.wolfcode.luowowo.article.domain;

import cn.wolfcode.luowowo.common.domain.BaseDomain;
import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Setter@Getter
public class Destination extends BaseDomain {
    public static final Integer STATE_HOT = 1; //热门
    public static final Integer STATE_NORMAL = 0; //普通
    //地区名称
    private String name;
    //是否热门
    private Integer hot = STATE_NORMAL;
    //封面
    private String coverUrl;
    //信息
    private String info;
    //层次
    private Integer deep;
    //父级目的地
    private Destination parent;
    //区域
    private Region region;
    //子目的地
    private List<Destination> children = new ArrayList<>();

    public String getJson() {
        Map<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("info", info);
        return JSON.toJSONString(map);
    }

    public String getHotName() {
        return hot == STATE_HOT ? "热门" : "普通";
    }
}